package threadman;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.net.UnknownHostException;


public class ThreadRunnerClient implements Runnable {
	public static void main(String[] args) {
		try {
			Socket s = new Socket("localhost", 88);
			
			ObjectOutputStream oos = new ObjectOutputStream(s.getOutputStream());
			ObjectInputStream ois = new ObjectInputStream(s.getInputStream());
			
			TestThreadRunnerWork ttrw = new TestThreadRunnerWork();
			oos.writeObject(ttrw);
			TestObject to = (TestObject)ois.readObject();
			TestObjectPrinter.printObject(to);
			
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	public void run() {
		main(null);
		
	}
}
